//============================================================================
// Name        : Function2.cpp
// Author      : Anthony Varghese
// Version     :
// Copyright   : You are free to use this in any way
// Description : Examples of call-by-value and call-by-reference
//============================================================================

#include <iostream>
using namespace std;

int byvalue( int x, int y){
	x++; y--;
	return x + y;
}
int byreference( int& x, int y){
	x++; y--;
	return x + y;
}
int main() {
	cout << "Call by value:" << endl;
	int x = 100, y = 200;
	cout << " Initial values: x is " << x << " and y is " << y
			<< endl;

	int z = byvalue(x,y);
	cout << " x is " << x << " and y is " << y
			<< " and byvalue returns " << z << endl;
	cout << "Call by reference:" << endl;
	z = byreference(x,y);
	cout << " x is " << x << " and y is " << y
			<< " and byreference returns " << z << endl;

	return 0;
}
